package org.index.outofbounds;

public class ReversSting {

	public static void main(String[] args) {
		String givenStr ="Durga is good girl";
		char[] k = givenStr.toCharArray();
		char[] c = new char[k.length];
		//    for (int i = k.length-1; i >= 0; i--) {
		//		System.out.print(k[i]);
		//	}
		int begin = 0;
		int end = 0;
		int i = 0;
		int j = c.length - 1;
		for (i = 0; i < k.length; i++) {
			
			 end = i;
			if(k[i] == ' '){
				for(int m = end ; m >= begin ; m--){
					c[j] = k[m-1];
					j--;
				}

			}
			
		}
		 end = i-1;
		begin++;
		
		System.out.print(c);
	}

}
